/* 
 * Header file for Point3D
 * Programming by SochiX (http://sochix.ru)
 */

#ifndef _Point3D_HPP
#define _Point3D_HPP

#include <cmath>
#include "vector3D.hpp"

class Point3D
{
private:

public:
    double x,y,z;

    Point3D() {};
    Point3D(double px, double py, double pz) {x=px; y=py;z=pz;}
    Point3D(const Point3D& v) {x=v.x; y=v.y; z=v.z;}
    Point3D operator= (const Point3D& v) {x=v.x; y=v.y; z=v.z; return *this;}
    int operator==(const Point3D& v)const {return x==v.x && y==v.y && z==v.z;}
    int operator!=(const Point3D& v)const {return x!=v.x || y!=v.y || z!=v.z;}
	friend double distantion(Point3D&, Point3D&);
	friend Vector3D ConvertToVector(const Point3D&);
	friend Point3D ConvertToPoint(const Vector3D&);
	friend Point3D operator*(double, const Point3D&);
    friend Point3D operator*(const Point3D&, float);
    friend Vector3D operator+(const Point3D&, const Vector3D&);
    friend Vector3D operator+(const Vector3D&, const Point3D&);
    friend Vector3D operator-(const Point3D&, const Vector3D&); 
    friend Vector3D operator-(const Vector3D&, const Point3D&); 
    friend Vector3D operator-(const Point3D&, const Point3D&); 
    
};
inline double distantion(Point3D& A, Point3D& B) {return sqrt(pow(A.x-B.x,2)+pow(A.y-B.y,2)+pow(A.z-B.z,2));}
inline Vector3D ConvertToVector(Point3D& A) {return Vector3D(A.x,A.y,A.z);}
inline Point3D ConvertToPoint(Vector3D& A) {return Point3D(A.x,A.y,A.z);}
inline Point3D operator*(double a, const Point3D& v) {return Point3D(v.x*a,v.y*a,v.z*a);}
inline Point3D operator*(const Point3D& v, double a) {return Point3D(v.x*a,v.y*a,v.z*a);}
inline Vector3D operator+(const Point3D& u, const Vector3D& v) {return Vector3D(u.x+v.x,u.y+v.y,u.z+v.z);}
inline Vector3D operator+(const Vector3D& u, const Point3D& v) {return Vector3D(u.x+v.x,u.y+v.y,u.z+v.z);}
inline Vector3D operator-(const Point3D& u, const Vector3D& v) {return Vector3D(u.x-v.x,u.y-v.y,u.z-v.z);}
inline Vector3D operator-(const Vector3D& u, const Point3D& v) {return Vector3D(u.x-v.x,u.y-v.y,u.z-v.z);}
inline Vector3D operator-(const Point3D& u, const Point3D& v) {return Vector3D(u.x-v.x,u.y-v.y,u.z-v.z);}
#endif	/* _Point3D_HPP */

